home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / LOGO / H282.ZIP / MSWLOGO.ZIP / EXAMPLES.ZIP / CLOCK < prev    next >
Encoding:
Text File  |  1992-11-28  |  1.4 KB  |  96 lines

  1. to clock :seconds
  2. cs
  3. ht
  4. drawface
  5. make "sec 0
  6. make "min 0
  7. make "hour 0
  8. plottimehour :hour
  9. plottimemin :min
  10. plottimesec :sec
  11. repeat :seconds ~
  12.   [ ~
  13.   make "thetime gettime ~
  14.   make "nhour first :thetime ~
  15.   make "thetime butfirst :thetime ~
  16.   make "nmin first :thetime ~
  17.   make "thetime butfirst :thetime ~
  18.   make "nsec first :thetime ~
  19.   plottimesec :sec ~
  20.   if not equalp :min :nmin~
  21.     [~
  22.     plottimemin :min ~
  23.     if not equalp :hour :nhour~
  24.       [~
  25.       plottimehour :hour ~
  26.       plottimehour :nhour ~
  27.       ]~
  28.     plottimemin :nmin ~
  29.     ]~
  30.   plottimesec :nsec ~
  31.   make "hour :nhour~
  32.   make "min :nmin~
  33.   make "sec :nsec~
  34.   ]
  35. end
  36.  
  37. to drawface
  38. setheading 30
  39. pu
  40. repeat 12 ~
  41.   [~
  42.   fd 120 ~
  43.   setx xcor-12 ~
  44.   sety ycor+12 ~
  45.   label repcount ~
  46.   setx xcor+12 ~
  47.   sety ycor-12 ~
  48.   bk 120 ~
  49.   rt 30 ~
  50.   ]
  51. end
  52.  
  53. to gettime
  54. make "thetime parse time
  55. make "thetime butfirst :thetime
  56. make "thetime butfirst :thetime
  57. make "thetime butfirst :thetime
  58. make "thetime first :thetime
  59. make "thetime parse map "oo :thetime
  60. output :thetime
  61. end
  62.  
  63. to oo :a
  64. if equalp ": :a [output char 32] [output :a]
  65. end
  66.  
  67. to plottimehour :hour
  68. penreverse
  69. setpensize [5 5]
  70. setheading :hour*30
  71. pd
  72. fd 50
  73. pu
  74. bk 50
  75. end
  76.  
  77. to plottimemin :min
  78. penreverse
  79. setpensize [2 2]
  80. setheading :min*6
  81. pd
  82. fd 100
  83. pu
  84. bk 100
  85. end
  86.  
  87. to plottimesec :sec
  88. penreverse
  89. setpensize [1 1]
  90. setheading :sec*6
  91. pd
  92. fd 100
  93. pu
  94. bk 100
  95. end
  96.